<template>
  <div class="home">
   <el-menu router :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
  <el-menu-item index="/home">首页</el-menu-item>
  <el-menu-item index="/about">关于</el-menu-item>
  <el-menu-item index="/product">商品</el-menu-item>
  <el-menu-item @click='logout'>登出</el-menu-item>
  </el-menu>

  <el-main>
      <router-view />
      <HelloWorld/>
  </el-main>
  </div>
</template>

<script>
// @ <=> /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'Home',
  data(){
	  return {
		  activeIndex:'/home',
		  }
  },
  components: {
    HelloWorld
  },
  methods:{
	  logout(){
		  //登出操作：1）清理登录标记  2) 跳转到login
		  localStorage.setItem('isLogin',false);
		  this.$router.push('/login');
	  },
	  handleSelect(){}
  }
}
</script>
